<template>
  <div class="app">
    <h3 ref="test">我是App组件</h3>
    <h4>{{msg}}</h4>
    <button @click="showH3Text">点我提示h3标签内容</button>
    <School ref="xuexiao" />
  </div>
</template>

<script>
    import School from './components/School'
     
        export default {
       
            name: 'App',
            components: { School },
            data(){
                return {
                    msg:'欢迎学习Vue'
                }
            },
            methods: {
                showH3Text(){
                    alert(this.$refs.test.innerText)
                    console.log(this.$refs.xuexiao)//输出的是School组件的实例对象
                }
            },
        }
</script>
<style>
    .app{
        background-color: yellow;
        padding: 30px;
    }
</style>

